package com.gem.utils;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gem.back.entity.AoaTypeList;
import com.gem.back.service.IAoaTypeListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.List;

/**
 * @Description:字典值工具类
 */
@Component
public class TypeDictUtils {
    @Autowired
    private IAoaTypeListService service;
    private static IAoaTypeListService aoaTypeListService;
    @PostConstruct
    public void init(){
        aoaTypeListService = service;
    }

    /**
     * 根据status_model和sort_value获取对应的中文status_name
     */
    public String getTypeName(String model,Integer value){
        QueryWrapper<AoaTypeList> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("type_model",model);
        queryWrapper.eq("sort_value",value);
        AoaTypeList aoaTypeList = aoaTypeListService.getOne(queryWrapper);
//        System.out.println(aoaTypeList.getTypeName());
        return aoaTypeList.getTypeName();

    }


}
